package it.eng.area118.mdocommon.android.network;

import it.eng.area118.mdocommon.android.log.BasicLogger;

import java.io.Serializable;

public class NetworkData<ExtraData> implements Serializable {

	public static enum Reason {
		RADIO_TURNED_OFF;
	}

	public static enum ConnectionState {
		CONNECTED, DISCONNECTED;
	}

	public static enum ConnectedState {
		ACTIVE, DISACTIVE;
	}

	public static enum DisconnectedState {

	}

	/**
	 * 
	 */
	private static final long serialVersionUID = -3958120629789532535L;

	private String networkType;

	private String ip;

	private ConnectionState connectionState;

	private ConnectedState connectedState;

	private ExtraData extraData;

	public NetworkData() {
		connectionState = ConnectionState.DISCONNECTED;
	}

	public String getNetworkType() {
		return networkType;
	}

	public void setNetworkType(String networkType) {
		this.networkType = networkType;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public ExtraData getExtraData() {
		return extraData;
	}

	public void setExtraData(ExtraData extraData) {
		this.extraData = extraData;
	}

	public ConnectedState getConnectedState() {
		return connectedState;
	}

	public void setConnectedState(ConnectedState connectedState) {
		this.connectedState = connectedState;
	}

	public ConnectionState getConnectionState() {
		return connectionState;
	}

	public void setConnectionState(ConnectionState connectionState) {
		if (connectionState.equals(ConnectionState.DISCONNECTED)) {
			connectedState = ConnectedState.DISACTIVE;
		}
		this.connectionState = connectionState;
		BasicLogger.writeLog("NetworkUtils", "Setted Connection State to: "
				+ connectionState);
	}

	@Override
	public String toString() {
		return "NetworkData [networkType=" + networkType + ", connectionState="
				+ connectionState + ", connectedState=" + connectedState + "]";
	}

}
